import { createRouter, createWebHistory } from 'vue-router'
import Register from "@/views/wzz/register/Register.vue";
import Register1 from "@/views/wzz/register/Register1.vue";
import Register2 from "@/views/wzz/register/Register2.vue";
import Register3 from "@/views/wzz/register/Register3.vue";
import Login from "@/views/wzz/login/Login.vue";
import Main from "@/components/zgr/main/Main.vue";
import {useCounterStore} from "@/stores/counter.js";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register,
      redirect:'/register1',
      children:[
        {
          path: '/register1',
          name: 'register1',
          component: Register1
        },
        {
          path: '/register2',
          name: 'register2',
          component: Register2
        },
        {
          path: '/register3',
          name: 'register3',
          component: Register3
        },
      ]
    },
    {
      path: '/main',
      name: 'main',
      component: Main,
      redirect:"/ShouYe",//重定向
      children:[
        {
          path: "/ShouYe",//首页
          component: () => import("@/views/zgr/ShouYe.vue")
        },
        {
          path:'/JiuDian',//酒店
          component:()=>import("@/views/zgr/JiuDian.vue")
        },
        {
          path:"/planeHome",//飞机首页
          component:()=>import("@/views/ml/plane/PlaneHome.vue")
        },
        {
          path:"/boatHome",//轮船首页
          component:()=>import("@/views/scs/boat/BoatHome.vue")
        },
        {
          path:"/busHome",//汽车首页
          component:()=>import("@/views/scs/bus/BusHome.vue")
        },
        {
          path:"/home",//景点
          component:()=>import("@/views/yy/attractions/Home.vue")
        },
        {
          path:'/JingNeiYou',//国内游
          component:()=>import("@/views/zgr/JingNeiYou.vue")
        },
        {
          path:'/MyXinXi',//我的信息
          component:()=>import("@/views/zgr/MyXinXi.vue")
        },
        {
          path:'/pubres',//发布资源
          component:()=>import("@/views/scs/pub/PubRes.vue")
        },
        {
          path:"/planeSearch",//飞机搜索
          component:()=>import("@/views/ml/plane/PlaneSearch.vue")
        },
        {
          path:'/flydingdan',
          component: ()=>import("@/components/zgr/main/flydingdan.vue")
        },
        {
          path:"/boatSearch",//轮船搜索
          component:()=>import("@/views/scs/boat/BoatSearch.vue")
        },
        {
          path:'/lnquireAttractions',//景点查询
          component:()=>import("@/views/yy/attractions/LnquireAttractions.vue")
        },

        {
          path:'/JDXQ',
          component:()=>import("@/views/zgr/JDXQ.vue")
        },
        {
          path:'/JDXQYM',//景点详情页面
          component:()=>import("@/views/zgr/JDXQYM.vue")
        },
        {
          path:'/attractionsDetail',//景点详情
          component:()=>import("@/views/yy/attractions/AttractionsDetail.vue")
        },
        {
          path:'/flydingdan',//机票订单
          component:()=>import("@/views/zgr/flydingdan.vue")
        },
        {
          path:'/Boatdingdan',//船票订单
          component:()=>import("@/views/zgr/Boatdingdan.vue")
        },
        {
          path:'/jddingdan',//景点订单
          component:()=>import("@/views/zgr/JDDingdan.vue")
        }
      ]
    },

  ],
})
// router.beforeEach((to) => {
//   const userStore = useCounterStore()
//   if (!userStore.token && to.path!=='/') return '/'
// })
//暴露路由
export default router
